package com.changgou.goods.api;


import com.changgou.common.entity.Result;
import com.changgou.goods.pojo.Spec;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

@Api(value = "规格管理接口",description = "规格管理接口，提供页面的增删改查")
public interface SpecApi {
    /**
     * 查询全部数据
     * @return
     */

    @ApiOperation( "查询所有规格列表" )
    public Result findAll();

    /***
     * 根据ID查询数据
     * @param id
     * @return
     */
    @ApiOperation( "根据ID查询规格数据" )
    @ApiImplicitParams( @ApiImplicitParam(name = "id",value = "规格ID",required = true,paramType = "path",dataType = "int"))
    public Result findById(@PathVariable Integer id);


    /***
     * 新增数据
     * @param spec
     * @return
     */

    @ApiOperation("添加规格数据")
    public Result add(Spec spec);

    /***
     * 修改数据
     * @param spec
     * @param id
     * @return
     */
    @ApiOperation( "更新规格数据" )
    @ApiImplicitParams( @ApiImplicitParam(name="id",value = "规格ID",required = true,paramType="path",dataType = "int") )
    public Result update(Spec spec,Integer id);


    /***
     * 根据ID删除品牌数据
     * @param id
     * @return
     */
    @ApiOperation( "删除规格数据" )
    @ApiImplicitParams( @ApiImplicitParam(name="id",value = "规格ID",required = true,paramType="path",dataType = "int") )
    public Result delete(Integer id);

    /***
     * 多条件搜索品牌数据
     * @param searchMap
     * @return
     */
    @ApiOperation( "条件查询规格列表" )
    @ApiImplicitParams( @ApiImplicitParam(name = "searchMap",value = "条件查询 JSON数据，规格名称或者模板名称") )
    public Result findList(Map searchMap);


    /***
     * 分页搜索实现
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @ApiOperation( "条件查询规格列表" )
    @ApiImplicitParams( {@ApiImplicitParam(name = "searchMap",value = "条件查询 JSON数据，规格名称或者模板名称"),
                        @ApiImplicitParam(name="page",value = "页码",required = true,paramType = "path",dataType = "int"),
                        @ApiImplicitParam(name="size",value = "每页记录数",required = true,paramType = "path",dataType = "int")}
    )
    public Result findPage(Map searchMap, int page, int size);

}
